package com.xiaocg.builder;

public class Computer {
    private String cpu;
    private String memory;
    private String mainBoard;
    private String disk;

    private Computer(Builder builder) {
        this.cpu = builder.cpu;
        this.memory = builder.memory;
        this.mainBoard = builder.mainBoard;
        this.disk = builder.disk;
    }

    public final static class Builder{
        private String cpu;
        private String memory;
        private String mainBoard;
        private String disk;

        public Builder cpu(String name){
            this.cpu = cpu;
            return this;
        }
        public Builder memory(String memory){
            this.memory = memory;
            return this;
        }
        public Builder mainBoard(String mainBoard){
            this.mainBoard = mainBoard;
            return this;
        }
        public Builder disk(String disk){
            this.disk = disk;
            return this;
        }

        public Computer build(){
            return new Computer(this);
        }

    }

    public String getCpu() {
        return cpu;
    }

    public void setCpu(String cpu) {
        this.cpu = cpu;
    }

    public String getMemory() {
        return memory;
    }

    public void setMemory(String memory) {
        this.memory = memory;
    }

    public String getMainBoard() {
        return mainBoard;
    }

    public void setMainBoard(String mainBoard) {
        this.mainBoard = mainBoard;
    }

    public String getDisk() {
        return disk;
    }

    public void setDisk(String disk) {
        this.disk = disk;
    }

    @Override
    public String toString() {
        return "Computer{" +
                "cpu='" + cpu + '\'' +
                ", memory='" + memory + '\'' +
                ", mainBoard='" + mainBoard + '\'' +
                ", disk='" + disk + '\'' +
                '}';
    }
}
